/*请实现一个函数，把字符串 s 中的每个空格替换成"%20"。*/

package Offer;
public class T05_replaceSpace {
    public String replaceSpace(String s) {
        StringBuffer sb = new StringBuffer();
        for (int i = 0; i < s.length(); i++) {
            if (s.charAt(i) == ' ') {
                sb.append("%20");
            }else {
                sb.append(s.charAt(i));
            }
        }
        return String.valueOf(sb);
    }
}